<?php
namespace app\api\controller\xiservice;

use app\common\controller\xiservice\XiserviceApi;
use app\common\model\xiservice\Question as QuestionModel;
use think\Db;
use think\Cache;
/**
 * 常见问题模块
 */
class Question extends XiserviceApi
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];


    /**
     * @ApiTitle    (获取常见问题接口)
     * @ApiMethod   (GET)
     * @ApiRoute    (/api/xiservice.question/list)
     * @ApiReturnParams   (name="code", type="integer", required=true, sample="0")
     * @ApiReturnParams   (name="msg", type="string", required=true, sample="返回成功")
     * @ApiReturnParams   (name="data", type="object", sample="{'id':'int','name':'string'}", description="返回数据")
     */
	public function list()
	{
      $list = QuestionModel::where('status',1)
                        ->order('weigh desc')
                        ->field(['id','name','desc'])
                        ->select();
	  $this->success('查询成功', $list);
	}	


    /**
     * @ApiTitle    (获取常见问题详情接口)
     * @ApiMethod   (GET)
     * @ApiRoute    (/api/xiservice.question/detail)
     * @ApiParams   (name="id", type="int", description="常见问题id")
     * @ApiReturnParams   (name="code", type="integer", required=true, sample="0")
     * @ApiReturnParams   (name="msg", type="string", required=true, sample="返回成功")
     * @ApiReturnParams   (name="data", type="object", sample="{'id':'int','name':'string',content':'string'}", description="返回数据")
     */
    public function detail()
    {
      $id = $this->request->request('id');  
      $list = QuestionModel::where('id',$id)
                    ->where('status',1)
                    ->field(['id','name','content','createtime'])
                    ->find();
      $this->success('查询成功', $list);
    }   



}